package com.sky.mapper;

import com.sky.annotations.AutoFill;
import com.sky.dto.DishDTO;
import com.sky.entity.Dish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface DishMapper {

    /**
     * 根据分类id查询菜品数量
     *
     * @param categoryId
     * @return
     */
    @Select("select count(id) from dish where category_id = #{categoryId}")
    Integer countByCategoryId(Long categoryId);

    @AutoFill(OperationType.INSERT)
    void addDish(Dish dish);

    Integer[] getStatusByIds(Long[] ids);

    void deleteDishBatch(Long[] ids);

    void deleteDishFlavorBatch(Long[] ids);

    @AutoFill(OperationType.UPDATE)
    void updateDish(Dish dish);

    Dish getDish(Long id);

    List<Dish> list(Dish dish);

    Integer countByMap(Map map);
}
